import request from '@/router/axios'
import store from '@/store'
import {
  getMappingStatus,
  fenExYuangettoFixed,
  fenExYuangettoFixed2,
  fenExYuangettoFixed3,
  getQianxiangType,
  getLineName,
  getStationName
} from "../../../subwayRat/commonCheck";
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  selection: true,
  reserveSelection:false,
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  editBtn: false,
  emptyBtn:false,
  delBtn: false,
  align: 'center',
  addBtn: false,
  height: 450,
  column: [
  // {
  //   fixed: true,
  //   label: '主键',
  //   prop: 'id',
  //   span: 24,
  //   type: 'input',
  //   hide: true
  // }, 
  {
    hide: true,
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    // search: false,
    // searchslot:true,
    // cascaderItem: ["stationCode"],
    // props: {
    //   label: 'name',
    //   value: 'code'
    // },
    // dicUrl: "/check/check/getLineLists?userCode="+ store.getters.userInfo.userCode,
    display: true, // 动态显隐控制不能删除
    formatter: function(row, value , label, column){
      return getLineName(value);
    }
  }, {
    hide: true,
    label: '站点',
    prop: 'stationCode',
    type: 'select',
    // search: false,
    // searchslot:true,
    // dicFlag: false,
    // cascaderItem: ["tvmOrder"],
    // props: {
    //   label: 'name',
    //   value: 'code'
    // },
    // dicUrl: "/check/check/getStationLists?userCode="+ store.getters.userInfo.userCode + "&lineCode={{key}}",
    // display: true,// 动态显隐控制不能删除
    formatter: function(row, value , label, column){
      return getStationName(row.lineCode,value);
    }
  },{
    label: '收入日期',
    prop: 'settleTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    width: 90,
    search: true
  }, 
  {label: "TVM编号", prop: "tvmOrder",type:'select',search:true,searchslot:true},
  
  {
    label: '系统金额',
    prop: 'systemMoney',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'systemMoney');
    }
  },
  {
    label: '实点金额',
    prop: 'actualMoney',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed2(value+row.handOutMoney);
    }
  },
  {
    label: '差异金额',
    prop: 'diffMoney',
    formatter:function (row,value , label, column) {
      return fenExYuangettoFixed(row,'diffMoney');
    },
    search: false,
    hide: false,
  }, {
    label: '通知时间',
    prop: 'sendTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    search: true,
    hide: false,
  }, {
    hide: false,
    label: '机电协查差异原因',
    prop: 'replyReason',
    formatter:function (row,v) {
      return getMappingStatus('REPLY_REASON',v);
    },
    search: false,
    width: 120
  }, {
    hide: false,
    label: '客运协查差异原因',
    prop: 'kyReplyReason',
    formatter:function (row,v) {
      return getMappingStatus('KY_REPLY_REASON',v);
    },
    search: false,
    width: 120
  }, {
    hide: true,
    label: '客运专业详细描述',
    prop: 'kyReplyDetail',
    search: false
  }, {
    hide: false,
    label: '机电协查状态',
    prop: 'jdReplyStatus',
    search: true,
	searchLabelWidth: 120,
    type: 'select',
    dicData: [{
      label: '未反馈',
      value: '0'
    }, {
      label: '已反馈',
      value: '1'
    }],
    formatter:function (row, value , label, column){
      return value == 1?'已反馈':'未反馈';
    },
    width: 100
  }, {
    hide: false,
    label: '客运协查状态',
    prop: 'kyReplyStatus',
    type: 'select',
    dicData: [{
      label: '未反馈',
      value: '0'
    }, {
      label: '已反馈',
      value: '1'
    }],
    formatter:function (row, value , label, column){
      return value == 1?'已反馈':'未反馈';
    },
    search: true,
	searchLabelWidth: 120,
    width: 100
  }]
}
export function get_xw_SwAuTvmMoneyAssistList(param) {
  return request({
    url: '/check/checkNew/get_xw_SwAuTvmMoneyAssistList',
    method: 'post',
    data: param,
    params: param
  })
}
export function updateSwAuTvmMoneyAssist(param) {
  return request({
    url: '/check/checkNew/updateSwAuTvmMoneyAssist',
    method: 'post',
    data: param
  })
}
export function updateSwAuTvmMoneyAssistToStatus(param) {
  return request({
    url: '/check/checkNew/updateSwAuTvmMoneyAssistToStatus',
    method: 'post',
    data: param
  })
}

/**
 * 导出
 * @param query
 */
 export function exportTvmMoneyAssist(query) {
  return request({
    url: '/check/checkNew/exportTvmMoneyAssist',
    method: 'get',
    params: query,
    responseType:'blob'
  })
}

export const xw_TVM_pkcy_cols1= {
  emptyBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  border: true,
  index: false,
  header:false,
  menu:false,
  indexLabel: '序号',
  align: 'center',
  menuWidth: 150,
  menuAlign: 'center',
  selection: false,
  reserveSelection: false,
  column: [{
    label: '钱箱类型',
    prop: "boxCashType",
    formslot: true,
    formatter: function (row, value, label, column) {
      return getQianxiangType(value);
    },
  },
    // {
    //   label: '钱箱编号',
    //   prop: "cashBoxCode",
    //   formslot: true,
    // },
    {
      label: '系统金额',
      prop: "systemMoney",
      // formslot: true,
      // formatter:function (row,v) {
      //   if(row.boxUninstallStatus==1){
      //     return v
      //   }else{
      //     return '未卸载';
      //   }
      // }
    },
    {
      label: '协查系统金额',
      prop: "replyDsiplayMoney",
      type:'number',
      precision:2,
      width:140,
    },
    {
      label: '卸载显示金额差异',
      prop: "diffUnloadDisplayMoney",
      formatter:function (row,v) {
        if(row.boxUninstallStatus==1){
          row.diffUnloadDisplayMoney=row.tvmUnloadMoney-row.replyDsiplayMoney;
          return row.diffUnloadDisplayMoney;
        }else{
          return '';
        }
      },
      hide: true
    },
    {
      label: '实点金额',
      prop: "actualMoneyNew",
      formatter:function (row,v) {
        return fenExYuangettoFixed2(row.handOutMoney+row.actualMoney);
      },
    },
    {
      label: '差异金额',
      prop: "replyActualMoneyNew",
      formatter:function (row,v) {
        return fenExYuangettoFixed3(fenExYuangettoFixed2(row.handOutMoney+row.actualMoney)-row.systemMoney);
      },
      //type:'number',
      //cell: true,
      disabled: true,
      precision:2,
      width:140,
    },
    {
      label: '协查补卸载金额',
      prop: "loadUnloadMoney",
      formatter:function (row,v) {
        if(row.boxUninstallStatus==3){
          return v;
        }else{
          return '';
        }
      },
      hide: true
    },
    {
      label: '协查补卸载金额',
      prop: "replyLoadUnloadMoney",
      width:140,
      type:'number',
      precision:2,
      hide: true
    },
    {
      label: '补卸载金额差异',
      prop: "diffLoadUnloadMoney",
      formatter: function (row,v) {
        if(row.boxUninstallStatus==3){
          row.diffLoadUnloadMoney=row.loadUnloadMoney-row.replyLoadUnloadMoney;
          return row.diffLoadUnloadMoney;
        }else{
          return '';
        }
      },
      hide: true
    },
    {
      label: '补币金额',
      prop: "supplementMoney",
      formslot: true,
    },
    {
      label: '协查补币金额',
      prop: "replySupplementMoney",
      width:140,
      type:'number',
      precision:2,
    },
    {
      label: '补币金额差异',
      prop: "diffSupplementMoney",
      formatter:function (row,v) {
        row.diffSupplementMoney=row.supplementMoney-row.replySupplementMoney;
        return row.diffSupplementMoney;
      },
      hide: true
    },
    {
      label: '手工清出金额',width:140,
      prop: "handOutMoney",
      hide: true
    }]
};



export const xw_TVM_pkcy_cols2= {
  emptyBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  border: true,
  index: false,
  header:false,
  menu:false,
  indexLabel: '序号',
  align: 'center',
  menuWidth: 150,
  menuAlign: 'center',
  selection: false,
  reserveSelection: false,
  column: [{
    label: '钱箱类型',
    prop: "cashBoxType",
    formslot: true,
    formatter: function (row, value, label, column) {
      return getQianxiangType(value);
    },
  },
    // {
    //   label: '钱箱编号',
    //   prop: "cashBoxCode",
    //   formslot: true,
    // },
    {
      label: '协查显示金额',
      prop: "tvmUnloadMoney",
      // formslot: true,
      formatter:function (row,v) {
        if(row.boxUninstallStatus==1){
          return v
        }else{
          return '未卸载';
        }
      }
    },
    {
      label: '协查显示金额',
      prop: "replyDsiplayMoney",
      cell: true,
      type:'number',
      precision:2,
      width:140,
    },
    {
      label: '卸载显示金额差异',
      prop: "diffUnloadDisplayMoney",
      formatter:function (row,v) {
        if(row.boxUninstallStatus==1){
          row.diffUnloadDisplayMoney=row.tvmUnloadMoney-row.replyDsiplayMoney;
          return row.diffUnloadDisplayMoney;
        }else{
          return '';
        }
      },
      hide: true
    },
    {
      label: '实点金额',
      prop: "actualMoney",
    },
    {
      label: '协查补卸载金额',
      prop: "loadUnloadMoney",
      formatter:function (row,v) {
        if(row.boxUninstallStatus==3){
          return v;
        }else{
          return '';
        }
      }
    },
    {
      label: '协查补卸载金额',
      prop: "replyLoadUnloadMoney",
      cell: true,
      width:140,
      type:'number',
      precision:2,
    },
    {
      label: '补卸载金额差异',
      prop: "diffLoadUnloadMoney",
      formatter: function (row,v) {
        if(row.boxUninstallStatus==3){
          row.diffLoadUnloadMoney=row.loadUnloadMoney-row.replyLoadUnloadMoney;
          return row.diffLoadUnloadMoney;
        }else{
          return '';
        }
      },
    },
    {
      label: '协查补币金额',
      prop: "supplementMoney",
      formslot: true,
    },
    {
      label: '协查补币金额',
      prop: "replySupplementMoney",
      cell: true,
      width:140,
      type:'number',
      precision:2,
    },
    {
      label: '补币金额差异',
      prop: "diffSupplementMoney",
      formatter:function (row,v) {
        row.diffSupplementMoney=row.supplementMoney-row.replySupplementMoney;
        return row.diffSupplementMoney;
      }
    }]
};



export const xw_TVM_pkcy_cols3= {
  emptyBtn: false,
  editBtn: false,
  delBtn: false,
  addBtn: false,
  border: true,
  index: false,
  header:false,
  menu:false,
  indexLabel: '序号',
  align: 'center',
  menuWidth: 150,
  menuAlign: 'center',
  selection: false,
  reserveSelection: false,
  column: [{
    label: '钱箱类型',
    prop: "cashBoxType",
    formslot: true,
    formatter: function (row, value, label, column) {
      return getQianxiangType(value);
    },
  },
    // {
    //   label: '钱箱编号',
    //   prop: "cashBoxCode",
    //   formslot: true,
    // },
    {
      label: '协查显示金额',
      prop: "tvmUnloadMoney",
      // formslot: true,
      formatter:function (row,v) {
        if(row.boxUninstallStatus==1){
          return v
        }else{
          return '未卸载';
        }
      }
    },
    {
      label: '协查显示金额',
      prop: "replyDsiplayMoney",
      cell: true,
      type:'number',
      precision:2,
      width:140,
    },
    {
      label: '卸载显示金额差异',
      prop: "diffUnloadDisplayMoney",
      formatter:function (row,v) {
        if(row.boxUninstallStatus==1){
          row.diffUnloadDisplayMoney=row.tvmUnloadMoney-row.replyDsiplayMoney;
          return row.diffUnloadDisplayMoney;
        }else{
          return '';
        }
      },
      hide: true
    },
    {
      label: '实点金额',
      prop: "actualMoney",
    },
    {
      label: '协查补卸载金额',
      prop: "loadUnloadMoney",
      formatter:function (row,v) {
        if(row.boxUninstallStatus==3){
          return v;
        }else{
          return '';
        }
      }
    },
    {
      label: '协查补卸载金额',
      prop: "replyLoadUnloadMoney",
      cell: true,
      width:140,
      type:'number',
      precision:2,
    },
    {
      label: '补卸载金额差异',
      prop: "diffLoadUnloadMoney",
      formatter: function (row,v) {
        if(row.boxUninstallStatus==3){
          row.diffLoadUnloadMoney=row.loadUnloadMoney-row.replyLoadUnloadMoney;
          return row.diffLoadUnloadMoney;
        }else{
          return '';
        }
      },
    },
    {
      label: '协查补币金额',
      prop: "supplementMoney",
      formslot: true,
    },
    {
      label: '协查补币金额',
      prop: "replySupplementMoney",
      cell: true,
      width:140,
      type:'number',
      precision:2,
    },
    {
      label: '补币金额差异',
      prop: "diffSupplementMoney",
      formatter:function (row,v) {
        row.diffSupplementMoney=row.supplementMoney-row.replySupplementMoney;
        return row.diffSupplementMoney;
      }
    }]
};
